<?php

namespace Kunfeng\Dify\Event;

/**
 * TTS消息结束事件
 */
class TtsMessageEndEvent extends BaseEvent
{
    private $messageId;
    private $audioUrl;

    public function __construct(
        string $event,
        array $data = []
    ) {
        parent::__construct($event, $data);
        
        $this->messageId = $data['message_id'] ?? '';
        $this->audioUrl = $data['audio_url'] ?? '';
    }
    /**
     * 从数组创建事件
     */
    public static function fromArray(array $data)
    {
        return new self($data['event'] ?? 'event', $data);
    }

    public function getMessageId(): string
    {
        return $this->messageId;
    }

    public function getAudioUrl(): string
    {
        return $this->audioUrl;
    }
}
